import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "home",
      component: () => import("../views/Home.vue"),
    },
    {
      path: "/about",
      name: "about",
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import("../views/AboutView.vue"),
    },
    {
      path: "/aaa",
      name: "aaa",
      component: () => import("../views/aaa.vue"),
    },
    {
      path: "/try",
      name: "try",
      component: () => import("../views/aaaaa111.vue"),
    },
    {
      path: "/tip",
      name: "tip",
      component: () => import("../views/Tip.vue"),
    },
    {
      path: "/login",
      name: "login",
      component: () => import("../views/Login.vue"),
      meta: { redirectAlreadyLogin: true },
    },
    {
      path: "/column/:id",
      name: "column",
      component: () => import("../views/ColumnDetail.vue"),
    },
    {
      path: "/createpost",
      name: "createPost",
      component: () => import("../views/CreatePost.vue"),
      meta: { reuqiredLogin: true },
    },
    {
      path: "/resign",
      name: "resign",
      component: () => import("../views/Resign.vue"),
    },
    {
      path: "/editInfo",
      name: "editInfo",
      component: () => import("../views/EditInfomation.vue"),
    },
    {
      path: "/post/:id",
      name: "post",
      component: () => import("../views/PostDetail.vue"),
    },
    {
      path: "/:catchAll(.*)",
      name: "notFound",
      component: () => import("../views/NotFound.vue"),
    },
  ],
});

export default router;
